package se.gu.sem;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

public class AboutActivity extends Activity{
	
	  @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        
	        
	          GUApp univ = ((GUApp)getApplicationContext());
	          
	          if(univ.getUniv().equals("GU"))
	        	  setContentView(R.layout.guabout);
	          else if(univ.getUniv().equals("CH"))
	        	  setContentView(R.layout.chabout);
	        

	    }

	   @Override
	    public boolean onCreateOptionsMenu(Menu menu) {
	        MenuInflater inflater = getMenuInflater();
	        inflater.inflate(R.menu.menuabout, menu);
	        return true;
	    }
	    
	    public void GoToGU(View v) {
	    	
	    	GUApp univ = ((GUApp)getApplicationContext());
	    	
	    	univ.setUniv("http://www.utbildning.gu.se/education/courses-and-programmes/program_detail/?programid=N2SOM");
	      	Intent intent= new Intent(AboutActivity.this,PageViewer.class);
	      	startActivity(intent);     
	    	
	        }
	    
	    public void GoToCH(View v) {
	    	
	    	GUApp univ = ((GUApp)getApplicationContext());
	    	
	    	univ.setUniv("http://www.chalmers.se/en/education/programmes/masters-info/Pages/Software-Engineering.aspx");	
	      	Intent intent = new Intent(AboutActivity.this,PageViewer.class);
	      	startActivity(intent);     
	    	
	        } 
	   
	    
	   public void showFeedback(View button) { 
		   
     	   Intent intent = new Intent(AboutActivity.this,FeedbackActivity.class);
     	   startActivity(intent);    
		 		   
		   
	   }
	   
	    @Override
	    public boolean onOptionsItemSelected(MenuItem item)
	    {    	
	    if(item.getTitle().toString().equals("Home"))
	    {	
	    	System.out.println();
	    	   Intent intent = new Intent(AboutActivity.this,GUActivity.class);
	    	   startActivity(intent);    
	    	   return true;
	     }
	    if(item.getTitle().toString().equals("Program Info"))
	    {    
	    	System.out.println();
	   	   Intent intent = new Intent(AboutActivity.this,ProgrameInfoActivity.class);
	   	   startActivity(intent);    
	   	   return true;
	    }
	      if(item.getTitle().toString().equals("Practical Info"))
	      {
	      	System.out.println();
	      	Intent intent = new Intent(AboutActivity.this,PracticalInfo.class);
	      	startActivity(intent);    
	      	return true;   
	      }
	       
	      if(item.getTitle().toString().equals("Twitter"))
	      {    
	    	  
	    	  
	    	  
	    	  GUApp univ = ((GUApp)getApplicationContext());
			  univ.setView("twitter");
	    	  
	     	  Intent intent = new Intent(AboutActivity.this,LoadingScreen.class);
	     	  startActivity(intent);    
	     	  return true;
	      }
	      
	      if(item.getTitle().toString().equals("Register for an exam"))
	      {    
	      	//System.out.println();
	     	   Intent intent = new Intent(AboutActivity.this,RegisterActivity.class);
	     	   startActivity(intent);    
	     	   return true;
	      }
	      
	     return super.onOptionsItemSelected(item);
	    
	    }
	    
}